import request from "@/utils/request";

export function fetchList(params) {
  return request({
    url: "/company/v1/",
    method: "get",
    params: params,
  });
}

export function deleteCompany(id) {
  return request({
    url: "/company/v1/" + id,
    method: "delete",
  });
}

export function createCompany(data) {
  return request({
    url: "/company/v1/",
    method: "post",
    data: data,
  });
}

export function updateCompany(id, data) {
  return request({
    url: "/company/v1/",
    method: "put",
    data: data,
  });
}

export function updateStatus(id, params) {
  return request({
    url: "/company/v1/updateStatus/" + id,
    method: "post",
    params: params,
  });
}

export function getCompany(id) {
  return request({
    url: "/company/v1/getone/" + id,
    method: "get",
  });
}

export function getAbleList(params) {
  return request({
    url: "/company/v1/getCompanyAbleList",
    method: "get",
    params: params,
  });
}

export function fetchTreeList() {
  return request({
    url: "/company/v1/treeList",
    method: "get",
  });
}

export function syncCompany() {
  return request({
    url: "/company/v1/sync_robot",
    method: "get",
  });
}

export function getCompanyWxCode(id) {
  return request({
    url: "/company/v1/getCompanyWxCode/" + id,
    method: "get",
  });
}

export function bindingWx(wxid, companyId) {
  return request({
    url: "/company/v1/bindingWx",
    method: "post",
    data: "wxid=" + wxid + "&companyId=" + companyId,
  });
}

export function checkWxAbnormal(id, rename) {
  return request({
    url: "/wx-abnormal/v1/checkCompanyWxCode/" + id + "&" + rename,
    method: "get",
  });
}
